<?php
require_once "xpface/util/PostData.class.php";
class HttpDataSource implements IDataSource {
    public function getData($sourceData, $format) {
        $data = PostData::post($sourceData, $_REQUEST);
        //var_dump($data);
        switch ($format) {
            case "xml":
            {
                return simplexml_load_string($data);
                break;
            }
            case "json":
            {
                $parsedData = json_decode($data);
                if (strlen($data) > 0 && $parsedData === null) {
                    var_dump($sourceData, $data);
                }
                return $parsedData;
                break;
            }
            default:
            {
                return $data;
                break;
            }
        }
    }
}